﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="RecursoGrid.ascx.cs" 
Inherits="UILGestion.ObraAdmin.Presupuesto.RecursoGrid" %>
<%@ Register Assembly="WebLib" Namespace="WebLib" TagPrefix="lib" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<input id="idParent" type="hidden"  runat="server"/>
<input id="idRendicion" type="hidden"  runat="server"/>
<input id="idEstado" type="hidden"  runat="server"/>
<input id="bitViewPresupuestoEditEver" type="hidden"  runat="server"/>


<asp:GridView ID="itemGridView" runat="server" 
                              AutoGenerateColumns="False" 
                              CellPadding="4" DataKeyNames="idInternal"  
                              SkinID="GridView"
                              ShowFooter="true" 
                              onrowcancelingedit="CancelItem" 
                            onrowediting="EditItem" 
                            OnRowUpdating="UpdateItem" 
                           
                            >
                              <Columns>

                                 <asp:TemplateField HeaderText="ID" HeaderStyle-Width="35px" HeaderStyle-ForeColor="Blue">
                                      <ItemTemplate>
                                          <asp:Label ID="idbl" runat="server" Text='<%# Eval("idInternal")%>'></asp:Label>
                                       </ItemTemplate>
                                       <EditItemTemplate>
                                           <asp:Label ID="islbl" runat="server" Text='<%# Eval("idInternal")%>'></asp:Label>
                                      </EditItemTemplate>
                                      <FooterTemplate>
                                          <lib:Input ID="descripcion1TXT" runat="server" Width="0px" ReadOnly="true"></lib:Input>
                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>

                                  <asp:TemplateField HeaderText="CODIGO" HeaderStyle-Width="75px">
                                      <ItemTemplate>
                                          <asp:Label ID="codigoLBL" runat="server" Text='<%# Eval("codigo")%>'></asp:Label>
                                       </ItemTemplate>
                                       <EditItemTemplate>
                                          <asp:Label ID="codigoLBL" runat="server" Text='<%# Eval("codigo")%>'></asp:Label>
                                     </EditItemTemplate>
                                      <FooterTemplate>
                                            <lib:Input ID="codigoTXT" runat="server" Text='<%# Eval("codigo")%>' Width="75px" ReadOnly="true" BackColor="Transparent" />
                                            <lib:Input ID="idInsumoTXT" runat="server"  Width="0px" ReadOnly="true" BackColor="Transparent" />

                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>
                                  <asp:TemplateField HeaderText="RECURSO" HeaderStyle-Width="350px">
                                      <ItemTemplate>
                                          <asp:Label ID="descripcionlbl" runat="server" Text='<%# Eval("descripcion")%>'></asp:Label>
                                       </ItemTemplate>
                                         <EditItemTemplate>
                                          <asp:Label ID="descripcionlbl" runat="server" Text='<%# Eval("descripcion")%>'></asp:Label>
                                          
                                        </EditItemTemplate>
                                        <FooterTemplate>
                                          <lib:Input ID="descripcionTXT" runat="server"  DataType="List" 
                                          method="GetRecursos" Width="100%"     
                                          onchange="javascript:validarRecurso(this);" OnSelect="SelectRecurso"></lib:Input>

                                       </FooterTemplate>
                                     
                                  </asp:TemplateField>
                                  <asp:TemplateField HeaderText="UNIDAD"   HeaderStyle-Width="35px" ItemStyle-HorizontalAlign="Right">
                                      <ItemTemplate>
                                          <asp:Label ID="unidadlbl" runat="server" Text='<%# Eval("unidad")%>'></asp:Label>
                                       </ItemTemplate>
                                        <EditItemTemplate>
                                        <asp:Label ID="unidadlbl" runat="server" Text='<%# Eval("unidad")%>'></asp:Label>
                                           
                                      </EditItemTemplate>

                                      <FooterTemplate>
                                      <lib:Input ID="unidadTXT" runat="server" Width="100%" ReadOnly="true" BackColor="Transparent" ></lib:Input>
                                            
                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>
                                  <asp:TemplateField HeaderText="CANTIDAD" HeaderStyle-Width="95px" ItemStyle-BackColor="LightGoldenrodYellow" ItemStyle-HorizontalAlign="Right">
                                      <ItemTemplate>
                                        <asp:Label ID="cantidadlbl" runat="server" Text='<%# Eval("cantidadStr")%>'></asp:Label>
                                       </ItemTemplate>
                                      <EditItemTemplate>
                                        <lib:Input ID="cantidadTXT" runat="server" DataType="Double" 
                                         onchange="javascript:calcularTotalXCantidad(this);"
                                         Text='<%# Eval("cantidadStr")%>' Width="100%"  ></lib:Input>

                                      </EditItemTemplate>

                                      <FooterTemplate>
                                      <lib:Input ID="cantidadTXT" runat="server"  
                                       onchange="javascript:calcularTotalXCantidad(this);"
                                      DataType="Double" Width="100%"  ></lib:Input>
                                            
                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>
                                <asp:TemplateField HeaderText="PRECIO" HeaderStyle-Width="120px" ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="LightGoldenrodYellow">
                                      <ItemTemplate>
                                          <asp:Label ID="precioLBL" runat="server" Text='<%# Eval("precioStr")%>'></asp:Label>
                                       </ItemTemplate>
                                      <EditItemTemplate>
                                           <lib:Input  ID="precioTXT" runat="server" 
                                           onchange="javascript:calcularTotalXPrecio(this);"
                                           DataType="Double" Text='<%# Eval("precio")%>' Width="100%" />
                                      </EditItemTemplate>

                                      <FooterTemplate>
                                            <lib:Input  ID="precioTXT" runat="server"  Width="100%"
                                            onchange="javascript:calcularTotalXPrecio(this);"
                                              DataType="Double"/>
                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>

                                   <asp:TemplateField HeaderText="TOTAL" HeaderStyle-Width="95px" ItemStyle-HorizontalAlign="Right" ItemStyle-BackColor="LightGoldenrodYellow">
                                      <ItemTemplate>
                                          <asp:Label ID="totalDbl" runat="server" 
                                          
                                          Text='<%# Eval("parcialStr")%>'></asp:Label>
                                       </ItemTemplate>
                                     <EditItemTemplate>
                                           <lib:Input ID="totalTxt" runat="server" 
                                            onchange="javascript:calcularPrecioXtotal(this);"
                                           Text='<%# Eval("parcial")%>' Width="100%"  DataType="Double" />
                                         
                                      </EditItemTemplate>

                                      <FooterTemplate>
                                            <lib:Input ID="totalTxt" runat="server" 
                                             onchange="javascript:calcularPrecioXtotal(this);"
                                             Width="100%" DataType="Double"/>

                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>


                                      <asp:TemplateField HeaderText="USO E/C" HeaderStyle-Width="95px" ItemStyle-HorizontalAlign="Right">
                                      <ItemTemplate>
                                       
               <asp:Hyperlink runat= "server"  ForeColor="Blue"
                Text='<%# DataBinder.Eval(Container.DataItem,"UsoECStr").ToString()%>'  
                 Target="_self"  ID="usoEC" ToolTip='<%# Eval("ECstr")%>'
                NavigateUrl='<%# Eval("rutaUsoStr")%>'
               />   



                                       </ItemTemplate>
                                     <EditItemTemplate>
                                           
                                      </EditItemTemplate>

                                      <FooterTemplate>
                                           
                                      </FooterTemplate>
                                     
                                  </asp:TemplateField>




                                  <asp:CommandField ButtonType="Image" CancelImageUrl="~/Images/cancel.gif" 
                            EditImageUrl="~/Images/edit.gif" ShowEditButton="true" 
                            UpdateImageUrl="~/Images/update.gif" />
                              
                                  <asp:TemplateField>
                                      <ItemTemplate>

                                        
                                          <asp:ImageButton ID="lnkRemove" runat="server" BorderColor="Control" 
                                              CommandArgument='<%# Eval("idInternal")%>' ImageUrl="~/Images/delete.gif" 
                                              OnClick="DeleteItem" OnClientClick="return confirm('Usted quiere eliminar?')" />
                                       </ItemTemplate>
                                      <FooterTemplate>

                                       
                                          <asp:Button ID="btnAdd" runat="server"   OnClick="AddItem" 
                                              Text="Añadir" />
                                        
                                      </FooterTemplate>
                                  </asp:TemplateField>
                              </Columns>
                              </asp:GridView>
